import { ArticleModelState, useDispatch, useSelector } from 'umi';
import { useEffect } from 'react';
import { formatDate } from '@/utils/index'
import './articleCord.less'
function StickyCardRead() {
  // 通过useSelector获取model数据
  const article = useSelector((state: { articleRead: ArticleModelState }) => state.articleRead);
  // 通过useDispatch获取dispatch
  const dispatch = useDispatch();
  useEffect(() => {
    // 派发任务
    dispatch({
      type: 'articleRead/getArticleList'
    })
  }, []);
  return <div className="stickyCardRead">
    <div className="stickyTopBox">
      <div className="stickyTitle">
        <span>推荐阅读</span>
      </div>
      <div className="stickyList">
        <ul>
          暂无数据
          {/* {
            article.articleList && article.articleList.map((item, index) => {
              return <li key={index}><a href={`/article/${item.id}`}>
                {item.title}
              </a>&emsp;<time className="formatDate">{formatDate(item.createAt) + '前'}</time>
              </li>
            })
          } */}
        </ul>
      </div>
    </div>
  </div>
}
export default StickyCardRead